package com.timesheet.gui.efforttracker.composite;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.forms.widgets.FormToolkit;

import com.timesheet.gui.employee.composite.NewEmployeeComposite;

public class TabsComposite extends Composite {
	
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());

	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public TabsComposite(Composite parent, int style) {
		super(parent, style);
		setLayout(new GridLayout(1, false));
		
		TabFolder tabFolder = new TabFolder(this, SWT.NONE);
		tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		
		TabItem tbtmNewEffort = new TabItem(tabFolder, SWT.NONE);
		tbtmNewEffort.setText("New Effort");
		
		
		SectionEffortComposite sectionEffortComposite = new SectionEffortComposite(tabFolder, SWT.NONE);
		//sectionEffortComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		tbtmNewEffort.setControl(sectionEffortComposite);
		//tbtmNewEffort.setControl(sectionEffortComposite);
		
		TabItem tbtmWsr = new TabItem(tabFolder, SWT.NONE);
		tbtmWsr.setText("WSR");
		
		tabFolder.setSelection(0);
		tabFolder.layout(true,true);
		
	
		SectionWSRComposite sectionWSRComposite = new SectionWSRComposite(tabFolder, style);
		tbtmWsr.setControl(sectionWSRComposite);
		
		TabItem tbtmUtilisation = new TabItem(tabFolder, SWT.NONE);
		tbtmUtilisation.setText("Utilisation");
		SectionUtilisationComposite sectionUtilisationComposite = new SectionUtilisationComposite(tabFolder, SWT.NONE);
		tbtmUtilisation.setControl(sectionUtilisationComposite);
		
		
		TabItem tabLeaves = new TabItem(tabFolder, SWT.NONE);
		tabLeaves.setText("Leaves");
		SectionLeaveComposite sectionLeaveComposite = new SectionLeaveComposite(tabFolder, style);
		tabLeaves.setControl(sectionLeaveComposite);
		
		TabItem tabEmployee = new TabItem(tabFolder, SWT.NONE);
		tabEmployee.setText("Manage Employee");
		SectionNewEmployeeComposite newEmployeeComposite = new SectionNewEmployeeComposite(tabFolder, style);
		tabEmployee.setControl(newEmployeeComposite);

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

}
